package com.person.service.consumer;

import com.alibaba.dubbo.config.annotation.Reference;
import com.person.service.api.PersonService;
import com.person.service.entity.Person;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("person")
public class PersonController {

    @Reference  //用的是dubbo的注解，标识是消费端
    private PersonService personService;

    @RequestMapping("/getOne")
    @ResponseBody
    public Person getOne(@RequestParam int id) {
        Person one = personService.getOne(id);
        return one;
    }
}
